<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@page import="com.sun.org.apache.bcel.internal.generic.INSTANCEOF,com.moment.model.InstrumentBankData"%>

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="EN" lang="EN"
	dir="ltr">
<head>
<title>Moment Mobile Payments</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="imagetoolbar" content="no" />
<link rel="stylesheet" href="<%=request.getContextPath()%>/styles/layout.css" type="text/css" />
<script src="//code.jquery.com/jquery-1.9.1.js"></script>
<script src="<%=request.getContextPath()%>/js/validation.js"></script>
<script>
	function hideform() {

		$('#instruForm').hide();

	}
	function showform() {
		$('#viewcard').hide();
		$('#instruForm').show();
	

	}
</script>


</head>
<body id="top" onLoad="hideform()">
	<%@include file="loggedinheader.jsp"%>
	<%@ page import="org.json.*"%>
	<%@ page import="com.moment.model.*"%>

	<%@ page language="java" contentType="text/html; charset=UTF-8"
		pageEncoding="UTF-8"%>
	<%@page import="java.util.*"%>
	<%!String visa;%>
	<%!String s[], master;%>


	<jsp:useBean id="userObj" class="com.moment.model.UserReg"
		scope="session" />
	<div class="wrapper col3">

		<div id="intro">
			<div id="logout">
				<a href="/MMP/LogoutController"><img src="<%=request.getContextPath()%>/images/logout.png"
					alt="Logout" /></a>
			</div>
			<div class="fl_left1">

				<div id="login1">
					<div class="imgl">
						<img alt="Embedded Image" height="128" width="128"
							src="data:image/jpeg;base64,<jsp:getProperty name="userObj" property="imagestr" />" />
					</div>
				</div>
				<div id="instrumentsmain">
					<div>

						<h2>
							<center>View Instrument</center>
						</h2>
					</div>
					
	<jsp:useBean id="instrumentObj" class="com.moment.model.InstrumentCardData" scope="session"/>
		<style>
		.control-label {display:inline-block; width:250px;}
		.control-group {padding-bottom:10px;}
	</style>
			
					<form action="../CardController" method="post" id="instruForm" >
			<div class="control-group">
				<label class="control-label" for="nickname">Instrument Name:</label>
				
					<input name="nickname" id="nickname" type="text" maxlength="15" value="<%=instrumentObj.getNickname() %>" class="required"/>
					<span style="display: none;" class="help-inline">Please fill instrument name</span>
				
			</div>
			<div class="control-group">
				<label class="control-label" for="instrumenttype">Instrument Type:</label>
				
					<select id="instrumenttype" name="instrumenttype">
										<option value="Card">Card</option>
										<!--<option value="Account">Account</option>-->
					</select>
			</div>
											<%
								System.out.println("cardtype "+instrumentObj.getCardtype());
								if(instrumentObj.getCardtype().equalsIgnoreCase("debit") ){
								 visa="selected = selected ";
								}else{
									master="selected = selected ";
								}
								%>
									<div class="control-group card">
				<label class="control-label" for="cardtype">Card Type:</label>
				
					<select id="cardtype" name="cardtype">
										<option value="debit" <%=visa %>>Debit Card</option>
										<option value="credit" <%=master %>>Credit Card</option>
					</select>
				
			</div>
			<div class="control-group card">
				<label class="control-label" for="cardno">Card No.:</label>
				
					<input name="cardno" id="cardno" type="text"  value="<%=instrumentObj.getCardno() %>"  class="required card"/>
					<span style="display: none;" class="help-inline">Please enter valid card number</span>
				
			</div>
			<div class="control-group card">
				<label class="control-label" for="cardexpiry">Card Expiry Date:</label>
			
Month:
              <select name="expirym">
              <% 
          	String[] expiry_date = instrumentObj.getExpirydate().split("-"); 
          	String month = expiry_date[0];
          	String year = expiry_date[1];            
          	String selected;
for(int i=1;i<=12;i++)
{

	String j = String.valueOf(i);
	selected = "";
	
	if(String.valueOf(i).length()==1)
	{
		j = "0"+String.valueOf(i);
	}
	if(month.equals(j))
	{
		selected = "selected='selected'";
	}
	
	out.println("<option value='"+j+"' "+selected+">"+j+"</option>");
}
%>	

              </select>
&nbsp; Year:&nbsp;
    <select name="expiryy">
              <% 
              
for(int i=2014;i<=2034;i++)
{
	selected = "";
	if(year.equals(String.valueOf(i)))
	{
		selected = "selected='selected'";
	}
	out.println("<option value='"+i+"' "+selected+">"+i+"</option>");
}
%>	     
    </select>
					
				
			</div>
						<div class="control-group">
				<label class="control-label" for="instruDlimit">Instrument Daily Limit:</label>
				
					<input type="text" name="instruDlimit" id="instruDlimit"  value="<%=instrumentObj.getDlimit() %>" class="required numeric"/>
					<span style="display: none;" class="help-inline">Please enter numeric values only.</span>
				
			</div>
			<div class="control-group">
				<label class="control-label" for="instruMlimit">Instrument Monthly Limit:</label>
				
					<input type="text" name="instruMlimit" id="instruMlimit" value="<%=instrumentObj.getMlimit() %>" class="required numeric"/>
					<span style="display: none;" class="help-inline">Please enter numeric values only.</span>
				
			</div>
								<input type="hidden" id="updateorsave" name="updateorsave" value="update"/>
					<div class="fl_right">
						<input type="submit" class="myButton" value="Update"/>
					</div>
					</form>

					



		<div  id="viewcard">

						<table>

							<tr>
								<td>Instrument Name:</td>
								<td>
								<label><%=instrumentObj.getNickname() %></label>
								 </td>
							</tr>
							<tr>
								<td>Instrument Type:</td>
								<td>
								<label><%=instrumentObj.getInstrutype() %></label>
								</td>
							</tr>
							
								<tr class="card">
									<td>Card No:</td>
									<td>
									<label><%=instrumentObj.getCardno() %></label>
									</td>
								</tr>
								<tr class="card">
									<td>Card Exp Date:</td>
									<td>
									<label><%=instrumentObj.getExpirydate() %></label>
									
									</td>
								</tr>
								
							
								<tr class="card">
									<td>Card Type:</td>
									<td>
									<label><%=instrumentObj.getCardtype() %></label>
									</td>
								</tr>
							
							
						
				

							<tr>
								<td>Instrument D Limit</td>
								<td>
								<label><%=instrumentObj.getDlimit() %></label>
								</td>
							</tr>
							<tr>
								<td>Instrument M Limit</td>
								<td>
								<%=instrumentObj.getMlimit() %>
								
								</td>
							</tr>
							
						</table>




					<div class="fl_right">
						<input type="button" class="myButton" value="Edit" onClick="showform()"/>
					</div>
					</div>
				</div>

			</div>
		</div>
	</div>
	<br class="clear" />


	<%@include file="footer.jsp"%>


</body>
</html>

